#coding=utf-8
import os
import subprocess
fi_dir = '/media/ts/bf009940-9f3e-40d8-a2ee-2cd85cde27f9/ts/0901/dep_fail'
file_dir = r'/media/ts/bf009940-9f3e-40d8-a2ee-2cd85cde27f9/ts/0901/dep_fail'
path = os.walk(file_dir)
file35 = "f36match.txt"
FILENAME = '/media/ts/bf009940-9f3e-40d8-a2ee-2cd85cde27f9/ts/0901/dep_sigal'
for i in os.walk(file_dir):
    #print(i[0])
    for j in i[2]:
        end = j.find(".txt")
        fail_name = j[0:end]
       # print(fail_name)
        for head in open(file35, 'r'):
            head = head.replace("\n","")
            if(fail_name==head):
        
                print(fi_dir,j,FILENAME)
                subprocess.run(["sudo","sh", "a.sh",fi_dir+'/'+j])
                break
